package demo.dcs.aspect;

import java.lang.reflect.Field;

public class JedisPoolFieldsCache {

    private static JedisPoolFieldsCache instance;
    private final Field internalPoolFiled;

    private JedisPoolFieldsCache() throws Exception {
        internalPoolFiled = redis.clients.util.Pool.class.getDeclaredField("internalPool");
        internalPoolFiled.setAccessible(true);
    }

    public static JedisPoolFieldsCache getInstance() throws Exception {

        if (instance == null) {
            synchronized (JedisPoolFieldsCache.class) {
                if (instance == null) {
                    instance = new JedisPoolFieldsCache();
                }
            }
        }
        return instance;
    }


    /**
     * @return the internalPoolFiled
     */
    public Field getInternalPoolFiled() {

        return internalPoolFiled;
    }


}